{extend name="layout/goods" /}

{block name="content"}
<!--顶部搜索-->
<header class='weui-header fixed-top'>
    {include file="common/search"}
</header>
<!--主体-->
<div class="weui-content" style="padding-top:45px;">
    <!--产品列表--滑动加载-->
    <!-- <div class="weui-pull-to-refresh__layer" style="display:none;">
        <div class='weui-pull-to-refresh__arrow'></div>
        <div class='weui-pull-to-refresh__preloader'></div>
        <div class="down">下拉刷新</div>
        <div class="up">释放刷新</div>
        <div class="refresh">正在刷新</div>
    </div> -->
    <div id="list" class='demos-content-padded proListWrap'>
        {volist name="list" id="v"}
        <div class="pro-items">
            <a href="{:url('goods/detail', ['id' => $v.id])}" class="weui-media-box weui-media-box_appmsg">
                <div class="weui-media-box__hd"><img class="weui-media-box__thumb" src="{$v.cover}" alt=""></div>
                <div class="weui-media-box__bd">
                    <h1 class="weui-media-box__desc">{$v.name}</h1>
                    <div class="wy-pro-pri">¥<em class="num font-15">{$v.price}</em></div>
                </div>
            </a>
        </div>
        {/volist}

    </div>
    <!-- <div class="weui-loadmore">
        <i class="weui-loading"></i>
        <span class="weui-loadmore__tips">正在加载</span>
    </div> -->
</div>
{/block}
{block name="script"}
<script>
// $(document.body).pullToRefresh().on("pull-to-refresh", function() {
//     setTimeout(function() {
//         $("#time").text(new Date);
//         $(document.body).pullToRefreshDone();
//     }, 2000);
// });
// infinite
var loading = false;
$(document.body).infinite().on("infinite", function() {
    if(loading) return;
    loading = true;
    setTimeout(function() {
        $("#list").append('<div class="pro-items"><a href="pro_info.html" class="weui-media-box weui-media-box_appmsg"><div class="weui-media-box__hd"><img class="weui-media-box__thumb" src="upload/pro3.jpg" alt=""></div><div class="weui-media-box__bd"><h1 class="weui-media-box__desc">由各种物质组成的巨型球状天体，叫做星球。星球有一定的形状，有自己的运行轨道。</h1><div class="wy-pro-pri">¥<em class="num font-15">296.00</em></div><ul class="weui-media-box__info prolist-ul"><li class="weui-media-box__info__meta"><em class="num">0</em>条评价</li><li class="weui-media-box__info__meta"><em class="num">100%</em>好评</li></ul></div></a></div>');
        loading = false;
    }, 2000);
});
</script>
{/block}
